package com.cumt.threeway.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.cumt.threeway.R;
import com.cumt.threeway.table.ActivitiesEntity;

import java.util.List;

/**
 * Created by 胡晶晶 on 2016/5/23.
 */
public class CheckSubmitInfoAdapter extends BaseAdapter {

    private List<ActivitiesEntity> mList;
    private Context mContext;

    public CheckSubmitInfoAdapter(Context context, List<ActivitiesEntity> list) {
        mContext = context;
        mList = list;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if(convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.wode_baominglist_layout, null);
            viewHolder = new ViewHolder();
            viewHolder.mTvName = (TextView) convertView.findViewById(R.id.tv_wodebaoming_aname);
            viewHolder.mTvDate = (TextView) convertView.findViewById(R.id.tv_date);
            viewHolder.mTvContent = (TextView) convertView.findViewById(R.id.tv_wodebaoming_content);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        ActivitiesEntity activities = mList.get(position);
        viewHolder.mTvName.setText(activities.getName());
        viewHolder.mTvDate.setText(activities.getTime());
        viewHolder.mTvContent.setText(activities.getIntroduce());
        return convertView;
    }

    class ViewHolder {
        private TextView mTvName;
        private TextView mTvDate;
        private TextView mTvContent;
    }
}
